﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _04_CountOccurenceOfANumber
{
    class Program
    {
        static int NumberCounter(int[] seachedArray, int number)
        {
            int counter = 0;
            for (int index = 0; index < seachedArray.Length; index++)
            {
                if (number == seachedArray[index])
                {
                    counter++;
                }
            }
            return counter;
        
        }

        static void Main(string[] args)
        {
            int[] firstArray = { 1, 2, 3, 4, 4, 1, 1, 1, 1, 2 };
            int firstSeekedNumber = 1;
            Console.WriteLine(NumberCounter(firstArray, firstSeekedNumber)); // 5
            Console.WriteLine();

            int[] secondArray = { 0, 1, 23, 12, -13, 13, 0, 0 };
            int secondSeekedNumber = -3;
            Console.WriteLine(NumberCounter(secondArray, secondSeekedNumber));

        }
    }
}
